package com.xxx.test;

import com.xxx.DAO.booksDao;
import com.xxx.entity.Book;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/updateBook")
public class updateBook extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String bName1=new String(request.getParameter("bName1").getBytes("UTF-8"),"UTF-8");
        String bName=new String(request.getParameter("bName").getBytes("UTF-8"),"UTF-8");
        String bAut=new String(request.getParameter("bAut").getBytes("UTF-8"),"UTF-8");
        String bPub=new String(request.getParameter("bPub").getBytes("UTF-8"),"UTF-8");
        int bSum= Integer.parseInt(request.getParameter("bSum"));
        String path=new String(request.getParameter("path").getBytes("UTF-8"),"UTF-8");
        booksDao dao=new booksDao();
        int i=dao.update(bName,bAut,bPub,bSum,path,bName1);
        request.getRequestDispatcher("showTable2?").forward(request,response);
        System.out.println(i);
    }
}

